package phoenics.apeak.bus.util;

import org.nustaq.serialization.FSTConfiguration;

public class FastSerializationUtils {
	private static FSTConfiguration configuration = FSTConfiguration.createStructConfiguration();

	public FastSerializationUtils() {
	}

	public static byte[] serialize(Object obj) {
		return configuration.asByteArray(obj);
	}

	@SuppressWarnings("unchecked")
	public static <T> T unserialize(byte[] sec, Class<T> t) {
		return (T) configuration.asObject(sec);
	}

	public static FSTConfiguration getConfiguration() {
		return FastSerializationUtils.configuration;
	}
	
	
}
